package tut.thread.runnable;


public abstract class ParentThread {

	public abstract void run();

	private int sleep = 1000;
	private Thread thread = null;


	public void start() {
		this.thread = new Thread(new MyRunnable(this));
		this.thread.start();
	}

	private class MyRunnable implements Runnable {
		private ParentThread parent;

		public MyRunnable(ParentThread parent) {
			this.parent = parent;
		}

		public void run() {

			while(true) {
				try {
					parent.run();
					System.out.println("runnable run");

					Thread.sleep(sleep);
				} catch (Exception e1) {
				}
			}

		}
	}
}
